/**
 * Copyright (C)  2011  chen wei hua.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 2.0
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU Free Documentation License".
 */
package com.javaeye.common.util;

import java.text.DecimalFormat;

public class NumberUtils {
	
	public static double formatDouble(double number) {
		DecimalFormat df=new DecimalFormat("#.00"); 
		return Double.parseDouble(df.format(number));
	}

	
	public static void main(String[] args) {
		System.out.println("1.2000026=" + formatDouble(1.2000026));
		System.out.println("0.3333333=" + formatDouble(0.3333333));
		System.out.println("0.3066666=" + formatDouble(0.3066666));
	}
}
